// SEE END OF FILE FOR LICENSE TERMS

#ifndef BAROMETRIC_ALTITUDE_H
#define BAROMETRIC_ALTITUDE_H

// Standard pressure at sea level in pascal
#define STANDARD_SEA_LEVEL_PRESSURE 1013250	 	// ubar


// absolute altitude vs sea level (it can be negative)
// +-0.01m
// Range = +-21.4km
unsigned int	absoluteAltitude;

// relative adjusted altitude vs zero offset point
// +-0.01m
// Range = +-21.4km
unsigned int	relativeAltitude;


// Call this to update the altitude after a new barmoteric pressure
// reading is received
void updateAltitude(void);


// Call this to update the ground pressure
// This adjusts the sea level pressure
void updateGroundPressure(unsigned int altitude);


void setGroundPressure(unsigned int altitude, unsigned long pressure);


void setAltitudeOffset(unsigned int altitude);

#endif

/****************************************************************************/
// This is part of the servo and radio interface software
//
// ServoInterface source code
//	http://code.google.com/p/rc-servo-interface
//
// Copyright 2010 ServoInterface Team
// See the AUTHORS.TXT file for a list of authors of ServoInterface.
//
// ServoInterface is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ServoInterface is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License 
// along with ServoInterface.  If not, see <http://www.gnu.org/licenses/>.
//
// Many parts of ServoInterface use either modified or unmodified code
// from the MatrixPilot pilot project.
// The project also contains code for modifying MatrixPilot to operate
// with ServoInterface.
// For details, credits and licenses of MatrixPilot see the AUTHORS.TXT file.
// or see this website: http://code.google.com/p/gentlenav
/****************************************************************************/
